<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
	<meta charset="UTF-8">
	<link rel="shortcut icon" href="favicon.ico">
	<link rel="stylesheet" href="css/iconfont.css">
	<link rel="stylesheet" href="css/global.css">
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/bootstrap-theme.min.css">
	<link rel="stylesheet" href="css/login.css">
	<link rel="stylesheet" href="css/styles.css">
	<script src="js/jquery.1.12.4.min.js" charset="UTF-8"></script>
	<script src="js/bootstrap.min.js" charset="UTF-8"></script>
	<script src="js/jquery.form.js" charset="UTF-8"></script>
	<script src="js/global.js" charset="UTF-8"></script>
	<script src="js/login.js" charset="UTF-8"></script>
	<title>登录 / 注册</title>
</head>
<body>
	<div class="public-head-layout container">
		<a class="logo" href="index.html"><img src="images/icons/logo.jpg" alt="U袋网" class="cover"></a>
	</div>
	<div style="background:url(images/login_bg.jpg) no-repeat center center; ">
		<div class="login-layout container">
			<div class="form-box login">
				<div class="tabs-nav">
					<h2>欢迎注册</h2>
				</div>
				<div class="tabs_container">
					<form class="tabs_form" action="addUser" method="post" id="login_form">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-phone" aria-hidden="true">账号</span>
								</div>
								<input class="form-control" name="username" id="username" placeholder="请输入账号"  type="text">
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true">密码</span>
								</div>
								<input class="form-control password" name="password" id="password" placeholder="请输入密码" type="password">
								<div class="input-group-addon pwd-toggle" title="显示密码"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></div>
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true">手机:</span>
								</div>
								<input class="form-control password" name="phone" maxlength="11" id="phone" placeholder="请输入手机" type="text">
								
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true">生日:</span>
								</div>
								<input class="form-control password" name="birthday" id="birthday" placeholder="请输入生日" type="text">
								
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<span class="glyphicon glyphicon-lock" aria-hidden="true">邮箱:</span>
								</div>
								<input class="form-control password" name="email" id="email" placeholder="请输入邮箱" type="text">
								
							</div>
						</div>
						<div class="form-group">
							<div class="error_msg" id="resetpwd_error"></div>
						</div>
						<div id="warning_2" style="display: none;"></div>
	                    <button class="btn btn-large btn-primary btn-lg btn-block submit" onclick="zhuCe()" id="login_submit" type="button">注册</button><br>
                    </form>
                </div>
			</div>
			<script src="layer/layer.js"></script>
			<script src="laydate/laydate.js"></script>
			<script>
			//执行一个laydate实例
			laydate.render({
			  elem: '#birthday' //指定元素
			});
				$(document).ready(function() {
					// 判断直接进入哪个页面 例如 login.php?p=register
					switch($.getUrlParam('p')) {						
						default: $('.login').show();
					};
					
				});
				function zhuCe(){
					var ps=$("#password").val();
					//var em=$("#email").val();
					//var reg =/^\w+@[a-z0-9]+\.[a-z]{2,4}$/;
					if (ps==null | ps.length<6) {
						layer.msg("密码不能为空且长度不能小于6");
					} else {
						$.post("addUser",{
							username:$("#username").val(),
							password:$("#password").val(),
							phone:$("#phone").val(),
							birthday:$("#birthday").val(),
							email:$("#email").val()
							
						},function(res){
							
							if (res.code=="0") {
								layer.msg(res.msg);
								window.location.href ="login.html" ;
							} else {
								layer.msg("账号已存在");
							}
							
						},"json");
					}
					
				}
				
				
			</script>
		</div>
	</div>
	
</body>
</html>